package com.controlier;


import com.domain.Global_data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Configuration

public class WebMvcConfig extends WebMvcConfigurationSupport{


    @Autowired
    Global_data global_data ;


    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //String vPath="file:"+System.getProperty("user.dir")+"\\download\\";
        String vPath="file:"+System.getProperty("user.dir")+"/download/";
        registry.addResourceHandler("/download/**").addResourceLocations(vPath);
        registry.addResourceHandler("/**").addResourceLocations( "classpath:/static/");

        super.addResourceHandlers(registry);
        System.out.println("虚拟目录是"+vPath);

        global_data.setLog_Grade(11);



    }

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/").setViewName("forward:/index.html");
    }



}